package com.by.controller;

import com.by.bean.Customer;
import com.by.common.bean.ResultBean;
import com.by.common.controller.BaseController;
import com.by.service.CustomerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


@Api(tags = "客户管理")
@RestController
@RequestMapping("/v1")
public class CustomerController extends BaseController {
    @Autowired
    CustomerService customerService;

@ApiOperation("修改客户信息")
@PutMapping("/customer")
    public ResultBean update(@Validated @RequestBody Customer customer, BindingResult result) {
     validate(result);
     int rs= customerService.update(customer);
     return updateResult(rs);
    }

    public ResultBean getCreateId(@RequestParam(name = "uid",required = true) int uid){
    int res =customerService.queryCreateIdByUid(uid);
    return success("创建人Id",res);
    }
}
